package com.example.tliaswebmanagement.service.impl;

import com.example.tliaswebmanagement.mapper.EmpLogMapper;
import com.example.tliaswebmanagement.entity.EmpLog;
import com.example.tliaswebmanagement.service.EmpLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EmpLogServiceImpl implements EmpLogService {

    private final EmpLogMapper empLogMapper;
    @Autowired
    public EmpLogServiceImpl(EmpLogMapper empLogMapper) {
        this.empLogMapper = empLogMapper;
    }

    //属性说明：不论是否有事务，都新创建一个事务，运行在一个独立的事务中
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public void insertLog(EmpLog empLog) {
        empLogMapper.insert(empLog);
    }
}
